import axios from "axios";

const axiosInstance = axios.create({
  baseURL: "http://127.0.0.1:5000",
  timeout: 2000,
});

// 请求拦截器
axiosInstance.interceptors.request.use((config) => {
  return config;
});
// 响应拦截器
axiosInstance.interceptors.response.use((res) => {
  return res;
});
// 配置跨域
axiosInstance.crossDomain = true;

export default function useAxios(app) {
  app.config.globalProperties.$http = axiosInstance;
}
